package com.rockbb.common.utilities.i18n;

import java.util.Locale;

public class Language 
{
	private int id;
	private String name;
	private String country;
	private String script;
	private String localName;
	public Language(int id, String name, String country, String script, String localName)
	{
		super();
		this.id = id;
		this.name = name;
		this.country = country;
		this.script = script;
		this.localName = localName;
	}
	public int getId()
	{
		return id;
	}
	public String getName() 
	{
		return name;
	}
	public String getCountry() 
	{
		return country;
	}
	public String getLocalName() 
	{
		return localName;
	}
	public String getScript()
	{
		return script;
	}

	public String getFullName() 
	{
		if (country == null || country.length() == 0) 
		{
			return name;
		}
		else
			return name+"_"+country;
	}

	public String getScriptName()
	{
		if (script == null || script.length() == 0) 
		{
			return name;
		}
		else
			return name+"-"+script;
	}

	/**
	 * @return 根据当前语言, 生成一个新的Locale对象
	 */
	public Locale getLocale() 
	{
		if (country == null || country.length() == 0) 
		{
			return new Locale(name);
		} 
		else
			return new Locale(name, country);
	}

}
